package com.megvii.koala.tv.presenter;

import com.megvii.koala.base.KoalaPresenter;
import com.megvii.koala.tv.event.TVEventAPI;
import com.megvii.koala.tv.fragment.MenuFragment;
import com.megvii.koala.tv.fragment.SettingsFragment;
import com.megvii.koala.tv.fragment.ThemeFragment;
import com.megvii.koala.tv.fragment.param.MenuParam;

/**
 * Created by linyue on 16/1/23.
 */
public class MenuPresenter extends KoalaPresenter<MenuFragment> implements MenuFragment.MenuListener
{
    private MenuParam param;

    @Override
    protected void onCreated()
    {
        super.onCreated();
        viewHolder.setListener(this);
        param = viewHolder.getParam();
        viewHolder.setRegisterButtonEnable(!param.isLocalVideoTheme);
    }

    @Override
    public void onBackPressed()
    {
        viewHolder.finish();
    }

    @Override
    public void onClickRegister()
    {
        TVEventAPI.sendClickMenuRegister();
        viewHolder.finish();
    }

    @Override
    public void onClickRefresh()
    {
        TVEventAPI.sendClickMenuRefresh();
        viewHolder.finish();
    }

    @Override
    public void onClickTheme()
    {
        viewHolder.startFragment(ThemeFragment.class, null);
    }

    @Override
    public void onClickSettings()
    {
        viewHolder.startFragment(SettingsFragment.class, null);
    }
}
